﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WW.NActiveRecord.Attriutes;

namespace WW.NActiveRecord.Tests.Models {

    [Table(Name = "Categories")]
    public class Category : Base<Category> {
        private readonly MemberField<int> categoryID = new MemberField<int>();
        private readonly MemberField<string> categoryName = new MemberField<string>();
        private readonly MemberField<string> description = new MemberField<string>();
        private readonly MemberField<byte[]> picture = new MemberField<byte[]>();
        private readonly MemberSet<Product> products = HasMany<Product>("categoryID");//Product.categoryID
        
        public Category()
        {

        }


        public int CategoryID {
            get {
                return this.categoryID;
            }
            set {
                this.categoryID.Value = value;
            }
        }

        public string CategoryName {
            get {
                return this.categoryName;
            }
            set {
                this.categoryName.Value = value;
            }
        }

        public string Description {
            get {
                return this.description;
            }
            set {
                this.description.Value = value;
            }
        }

        public byte[] Picture {
            get {
                return this.picture;
            }
            set {
                this.picture.Value = value;
            }
        }

 
        public EntitySet<Product> Products {
            get { return products.Value; }
        }

    }
}
